package com.sky.controller.admin;

import com.sky.dto.OrdersCancelDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.AdminOrderService;
import com.sky.vo.OrderStatisticsVO;
import com.sky.vo.OrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/order")
@Api(tags = "订单管理接口")
public class AdminOrderController {
    @Autowired
    AdminOrderService adminOrderService;



    /**
     *
     * @return
     */
    @GetMapping("/statistics")
    @ApiOperation("各个状态的订单数量统计")
    public Result countAmountOfOrders(){
        OrderStatisticsVO orderStatisticsVoO = adminOrderService.countAmountOfOrders();
        return Result.success(orderStatisticsVoO);
    }
    @PutMapping("/cancel")
    @ApiOperation("取消订单")
    public Result cancelOrders(@RequestBody OrdersCancelDTO ordersCancelDTO){
        adminOrderService.cancelOrders(ordersCancelDTO);
        return Result.success();
    }

}
